import requests, pprint

# 先登陆,获取sessionid
# payload = {
#     'username': 'root',
#     'password': '88888888'
# }
#
# response = requests.post("http://127.0.0.1:8000/api/mgr/signin",
#                          data=payload)
#
# retDict = response.json()

# sessionid = response.cookies['sessionid']
#
# # 再发送列出请求，注意多了 keywords
# payload = {
#     'action': 'list_medicine',
#     'pagenum': 1,
#     'pagesize': 3,
#     'keywords': '乳酸 注射液'
# }
#
# response = requests.get('http://127.0.0.1:8000/api/mgr/medicines',
#                         params=payload,
#                         cookies={'sessionid': sessionid})
#
# pprint.pprint(response.json())
